import request from '@/utils/request'

//查询用户列表
export function userList(data) {
  return request({
    url: "/sys/user/list",
    method: "post",
    data
  });
}

//修改或添加用户
export function saveAndUpdate(data) {
  return request({
    url: "/sys/user/saveAndUpdate",
    method: "post",
    data
  });
}
//用户状态 
export function updateStatus({id,status}) {
  return request({
    url: `/sys/user/updateStatus/${id}/status/${status}`,
    method: 'get'
  })
}
//删除用户
export function deleteUser (data) {
  return request({
    url: `/sys/user/delete`,
    method: 'post',
    data
  })
}
//用户角色授权
export function grantRole ({data,userId}) {
  return request({
    url: `/sys/user/grantRole/${userId}`,
    method: 'post',
    data
  })
}

//修改密码
export function updateUserPwd(data) {
  return request({
    url: '/sys/user/updateUserPwd',
    method: 'post',
    data
  })
}


export function updateAvatar(data) {
  return request({
    url: '/sys/user/updateAvatar',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/sys/user/updateUser',
    method: 'post',
    data
  })
}
//操作日志
export function list(params) {
  return request({
    url: '/sys/log/list',
    method: 'get',
    params
  })
}
